}
}
+QString Folder::filePath(const QString& fileName)
+{
+ const auto folderDir = QDir(_canonicalLocalPath);
+
+#ifdef Q_OS_WIN
+ // Edge case time!
+ // QDir::filePath checks whether the passed `fileName` is absolute (essentialy by using `!QFileInfo::isRelative()`).
+ // In the case it's absolute, the `fileName` will be returned instead of the complete file path.
+ //
+ // On Windows, if `fileName` starts with a letter followed by a colon (e.g. "A:BCDEF"), it is considered to be an
+ // absolute path.
+ // Since this method should return the file name file path starting with the canonicalLocalPath, catch that special case here and prefix it ourselves...
+ return fileName.length() >= 2 && fileName[1] == ':'
+ ? _canonicalLocalPath + fileName
+ : folderDir.filePath(fileName);
+#else
+ return folderDir.filePath(fileName);
+#endif
+}
+
bool Folder::isFileExcludedAbsolute(const QString &fullPath) const
{
return _engine->excludedFiles().isExcluded(fullPath, path(), _definition.ignoreHiddenFiles);
*/
[[nodiscard]] QString remotePathTrailingSlash() const;
+ /**
+ * Returns the path name of a file in the local canonical path.
+ *
+ * Similar to `QDir(path()).filePath(...)`, except file names like "Z:test"
+ * are treated as relative paths on Windows.
+ */
+ [[nodiscard]] QString filePath(const QString& fileName);
+
[[nodiscard]] QString fulllRemotePathToPathInSyncJournalDb(const QString &fullRemotePath) const;
void setNavigationPaneClsid(const QUuid &clsid) { _definition.navigationPaneClsid = clsid; }
}
auto folder = FolderMan::instance()->folder(activity._folder);
- const auto folderDir = QDir(folder->path());
const auto fileLocation = activity._syncFileItemStatus == SyncFileItem::FileNameInvalidOnServer
? InvalidFilenameDialog::FileLocation::NewLocalFile
: InvalidFilenameDialog::FileLocation::Default;
? InvalidFilenameDialog::InvalidMode::ServerInvalid
: InvalidFilenameDialog::InvalidMode::SystemInvalid;
-#ifdef Q_OS_WIN
- // Edge case time!
- // QDir::filePath checks whether the passed `fileName` is absolute (essentialy by using `!QFileInfo::isRelative()`).
- // On Windows, if `fileName` starts with a letter followed by a colon (e.g. "A:BCDEF"), it is considered to be an
- // absolute path.
- // Since the complete desired path is required by InvalidFilenameDialog, catch that special case here and prefix it ourselves...
- const auto filePath = activity._file.length() >= 2 && activity._file[1] == ':'
- ? folder->path() + activity._file
- : folderDir.filePath(activity._file);
-#else
- const auto filePath = folderDir.filePath(activity._file);
-#endif
-
_currentInvalidFilenameDialog = new InvalidFilenameDialog(_accountState->account(), folder,
- filePath, fileLocation, invalidMode);
+ folder->filePath(activity._file), fileLocation, invalidMode);
connect(_currentInvalidFilenameDialog, &InvalidFilenameDialog::accepted, folder, [folder]() {
folder->scheduleThisFolderSoon();
});